package adapter;

import com.example.traffic_learning.R;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MenuAdapter extends ArrayAdapter<String>{
	private final Context context;
	private final String[] menu;
	
	public MenuAdapter(Context context, String[] menu){
		super(context, R.layout.drawer_list_item, menu);
		this.context = context;
		this.menu = menu;
	}
	
	@SuppressLint("ViewHolder")
	@Override
	public View getView(int position, View convertView, ViewGroup parent){
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.drawer_list_item, parent, false);
		//ImageView imageItem = (ImageView)rowView.findViewById(R.id.imageMenu);
		switch(position){
			/*case 0:
				imageItem.setImageResource(R.drawable.menu_item_home);
				break;
			case 1:
				imageItem.setImageResource(R.drawable.menu_item_law_learning);
				break;
			case 2:
				imageItem.setImageResource(R.drawable.menu_item_study);
				break;
			case 3:
				imageItem.setImageResource(R.drawable.menu_item_test);
				break;
			case 4:
				imageItem.setImageResource(R.drawable.menu_item_traffic_sign_system);
				break;
			case 5:
				imageItem.setImageResource(R.drawable.menu_item_reconize_traffic_sign);
				break;
			case 6:
				imageItem.setImageResource(R.drawable.menu_item_signout);
				break;*/
		}
		
		TextView textItem = (TextView)rowView.findViewById(R.id.textMenu);
		textItem.setText(menu[position]);
		//textItem.setTextColor(#ffffff);
		return rowView;
	}
}
